﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Transfer.aspx.cs" Inherits="H2.NET.Web.Pages.SMD.Transfer" %>

<%@ Register src="../../Controls/DwzAssessment.ascx" tagname="DwzAssessment" tagprefix="uc" %>
<%@ Register src="../../Controls/DwzAssessmentList.ascx" tagname="DwzAssessmentList" tagprefix="uc" %>
<%@ Register src="../../Controls/AjaxUpload.ascx" tagname="ajaxUpload" tagprefix="uc" %>
<%@ Register src="uc_store_info.ascx" tagname="uc_store_info" tagprefix="uc" %>
<%@ Register src="uc_head.ascx" tagname="uc_head" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
<head id="Head1" runat="server">
    <title>设备三方转移</title>
    <link href="<%=Page.ResolveUrl("~/Resource/Css/Style.css")%>" type="text/css" rel="stylesheet" />
    <link href="<%=Page.ResolveUrl("~/Resource/jBox/Blue/jbox.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/Css/validform.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%=Page.ResolveUrl("~/Resource/dwz/js/jquery-1.7.2.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/Common.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/jquery.money.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-2.3.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-zh-CN.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/Validform_v5.3.2.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/My97DatePicker/WdatePicker.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.js")%>" type="text/javascript"></script>
    <script type="text/javascript">
        var step = "<%=TaskAPI.Step%>";
        $(function () {
            /* 初始化相关样式、表单验证提示 st */
            $("[datatype='*']").after("<em class='required'>*</em>");
            $("#form1").Validform({
                tipSweep: true,
                tiptype: function (msg, o, cssctl) {
                    if (o.type == 3) {
                        $.jBox.tip(msg, 'info');
                    }
                }
            });
            /* 初始化相关样式、表单验证提示 ed */

            // 双击选择门店之后跳转的url
            $("#return_url").val('<%=Page.ResolveUrl("~/pages/smd/Transfer.aspx?TaskID=" + TaskAPI.TaskID)%>');

            /* 初始化控件提示 st */
            $.ajax({
                type: 'POST',
                url: '<%=Page.ResolveUrl("~/pages/smd/ajaxtools/handler.ashx?action=get_tips")%>',
                data: { pagename: 'transfer.aspx' },
                dataType: "json",
                cache: false,
                success: function (json) {
                    for (var o in json) {
                        var ControlID = json[o].ControlID;
                        var Content = json[o].Content;
                        $("#" + ControlID).qtip({
                            content: Content
                        });
                    }
                }
            });
            /* 初始化控件提示 ed */

            // 隐藏选择
            if (step == "DMO Commit" || "<%= H2.NET.Common.AksRequest.GetString("readonly") %>" == "1") {
                $("#devicelist tr th:first-child").hide();
                $("#devicelist tr td:first-child").hide();
            }

            var check = "<%=deviceCheckes%>";
            $("[name = 'ckDevice']").each(function () {
                if (check.indexOf($(this).val()) >= 0) {
                    $(this).attr("checked", "checked");
                }
            });
        });

        /* 提交表单 st */
        function confirmSubmit() {

            if (window.confirm("确认要提交吗？")) {
                $.jBox.tip('正在处理，请稍等...', 'loading');
                return true;
            }
            return false;
        }
        /* 提交表单 ed */

        function hasDeposit(obj) {
            var cb = $(obj).find(":radio");
            $("#devicelist").attr("checked", false);
            $(cb).attr("checked", "checked");
            $("#tb_DeviceEapproveSN").val($(obj).find(".EapproveSN").text());
            // 是否涉及保证金变更
            if ($(cb).attr("deposit") == "0.00") {
                $("#cb_DepositConfiscated").attr("checked", false);
            } else {
                $("#cb_DepositConfiscated").attr("checked", "checked");
            }
        }
    </script>
</head>
<body>
    <div class="flowpage">
    <form id="form1" runat="server">
        <asp:HiddenField ID="hf_return_url" runat="server" />
        <asp:HiddenField ID="hf_out_storeId" runat="server" />
        <asp:HiddenField ID="hf_in_storeId" runat="server" />
        <!-- 标题 st -->
        <uc1:uc_head ID="uc_head1" runat="server" />
        <!-- 标题 ed -->
        
        <table class="formTable">
            <!-- 门店基本信息 st -->
            <uc:uc_store_info ID="uc_store_info1" runat="server"/>
            <!-- 门店基本信息 ed -->
            
            <!-- 门店基本信息 st -->
            <uc:uc_store_info ID="uc_store_info2" runat="server"/>
            <!-- 门店基本信息 ed -->
            
            <tbody>
                <tr>
                    <td colspan="6" class="title">要转出的设备</td>
                </tr>
                <tr>
                    <td colspan="6">
                        <table class="htable" id="devicelist">
                            <thead>
                            <tr>
                                <th style="text-align: center; width:5%;">选择</th>
                                <th style="text-align: center; width:13%;">系统流水号</th>
                                <th style="text-align: center; width:12%;">设备状态</th>
                                <th style="text-align: center; width:12%;">固定资产号</th>
                                <th style="text-align: center; width:10%;">机器初购年份</th>
                                <th style="text-align: center; width:10%;">安装时间</th>
                                <th style="text-align: center; width:10%;">调色机型号</th>
                                <th style="text-align: center; width:10%;">混合机型号</th>
                                <th style="text-align: center; width:10%;">电脑型号</th>
                                <th style="text-align: center; width:10%;">机器保证金</th>
                            </tr>
                            </thead>
                            <tbody>
                            <asp:Repeater ID="rpt_devices" runat="server">
                                <ItemTemplate>
                                    <tr onclick='hasDeposit(this)'>
                                        <td style="text-align:center;">
                                            <input type="radio" id="stDevice" name="ckDevice" deposit="<%#H2.NET.Common.Utils.StrToDecimal(Eval("Amount") == null ? "" : Eval("Amount").ToString(), 0).ToString("N")%>" value="<%#Eval("DeviceID")%>"/>
                                        </td>
                                        <td style="text-align: center" class="EapproveSN"><%#Eval("EapproveSN") %></td>
                                        <td style="text-align: center"><%#Eval("Status") %></td>
                                        <td style="text-align: center"><%#Eval("FullSetSN") %></td>
                                        <td style="text-align: center"><%#Eval("PurchasedDate") == null ? "" : Convert.ToDateTime(Eval("PurchasedDate").ToString()).ToString("yyyy-MM") %></td>
                                        <td style="text-align: center"><%#Eval("InstallDate") == null ? "" : Convert.ToDateTime(Eval("InstallDate").ToString()).ToString("yyyy-MM") %></td>
                                        <td style="text-align: center"><%#Eval("DispenserModel") %></td>
                                        <td style="text-align: center"><%#Eval("ShakerModel") %></td>
                                        <td style="text-align: center"><%#Eval("PcModel") %></td>
                                        <td style="text-align: right"><%#H2.NET.Common.Utils.StrToDecimal(Eval("Amount") == null ? "" : Eval("Amount").ToString(), 0).ToString("N")%></td>
                                    </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                            </tbody>
                            <tbody id="tb_noDevice" runat="server">
                                <tr>
                                    <td colspan="10" align="center">该门店没有设备。</td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr id="tr_depositChange" runat="server">
                    <th>设备系统流水号：</th>
                    <td>
                        <asp:TextBox ID="tb_DeviceEapproveSN" runat="server"></asp:TextBox>
                        <asp:Literal ID="l_DeviceEapproveSN" runat="server"></asp:Literal>
                    </td>
                    <th>是否涉及保证金变更：</th>
                    <td colspan="3">
                        <asp:CheckBox ID="cb_DepositConfiscated" runat="server" Checked Text="涉及" />
                        <asp:Literal ID="l_DepositConfiscated" runat="server"></asp:Literal>
                        <font style="color:red">如果所选设备的保证金为0或者同一经销商时，则可以不发起保证金变更。</font>
                    </td>
                </tr>
            </tbody>
                
            <!-- 需要填写的表单、相关附件 st -->
            <tbody>
                <tr>
                    <th>相关附件：</th>
                    <td colspan="5">
                        <uc:ajaxUpload ID="ajaxUpload1" runat="server" />
                    </td>
                </tr>
            </tbody>
            <!-- 需要填写的表单、相关附件 ed -->

            <!-- 审批列表 st -->
            <tbody id="assessment" runat="server" visible="false">
                <tr>
                    <td class="title" colspan="6">审批列表</td>
                </tr>
                <tr>
                    <td colspan="6">
                        <uc:DwzAssessmentList ID="DwzAssessmentList1" runat="server" />
                    </td>
                </tr>
            </tbody>
            <!-- 审批列表 ed -->

            <!-- 审批意见 st -->
            <tbody>
                <uc:DwzAssessment ID="DwzAssessment1" runat="server" />
            </tbody>
            <!-- 审批意见 ed -->
        </table>


    <%  if(H2.NET.Common.AksRequest.GetString("showbtn") != "0")
        { %>
        <div style="margin: 5px; padding-bottom: 10px; text-align: center;">
            <asp:Button ID="btn_submit" runat="server" CssClass="u-btn" Text="提交(Submit)" OnClick="btn_submit_Click" OnClientClick="return confirmSubmit();" />
            <input type="button" class="u-btn u-btn-c4" value="关闭(Close)" onclick="custom_close()" />
            <asp:HyperLink ID="hl_ExportPdf" runat="server" Visible="false" Target="_blank" CssClass="u-btn u-btn-c3" style="height:28px; line-height:28px; display:inline-block;">生成(PDF)</asp:HyperLink>
            <asp:Button ID="btn_print" runat="server" CssClass="u-btn u-btn-c2" Text="打印(Print)" OnClientClick="window.print()" Visible="false" />
        </div>
    <%  } %>
        </form>
    </div>
</body>

</html>